import React, { FC, useEffect } from "react";
import Menu from "../";
import { IMenuItem } from "../type";
import s from "./index.module.scss";

export interface MenuProps {
  /**
   * menuList
   */
  list: IMenuItem[];
  /**
   * menuClick callback
   */
  itemClick: (d: IMenuItem, index?: number) => void;
}
const MenuList: FC<MenuProps> = (props) => {
  const { list, itemClick } = props;
  const listNode = list.map((v, k) => {
    return (
      <div key={v.value}>
        <Menu itemClick={(d) => itemClick(d, k)} item={v} />
      </div>
    );
  });
  useEffect(() => {
    return () => {};
  }, []);
  return <div className={s.menu}>{listNode}</div>;
};

export default MenuList;
